import 'PhaseStatus.dart';
import 'PhaseCode.dart';
import 'ProjectType.dart';
import 'dart:convert';

/// phaseStatus : [{"code":"项目总量","topOrgId":"","cou":6,"codeId":""},{"code":"已完成","topOrgId":"","cou":0,"codeId":"PHASE_STATUS_4"},{"code":"进行中","topOrgId":"","cou":0,"codeId":"PHASE_STATUS_1"},{"code":"临期","topOrgId":"","cou":0,"codeId":"PHASE_STATUS_2"},{"code":"逾期","topOrgId":"","cou":6,"codeId":"PHASE_STATUS_3"}]
/// phaseCode : [{"code":"线索","topOrgId":"","cou":1,"codeId":""},{"code":"签约","topOrgId":"","cou":3,"codeId":""},{"code":"开工","topOrgId":"","cou":2,"codeId":""},{"code":"投产","topOrgId":"","cou":0,"codeId":""}]
/// projectType : [{"code":"重大项目","topOrgId":"","cou":5,"codeId":""},{"code":"一般项目","topOrgId":"","cou":1,"codeId":""},{"code":"其他","topOrgId":"","cou":0,"codeId":""}]

ProjectStatistical projectStatisticalFromJson(String str) => ProjectStatistical.fromJson(json.decode(str));
String projectStatisticalToJson(ProjectStatistical data) => json.encode(data.toJson());
class ProjectStatistical {
  ProjectStatistical({
      this.phaseStatus, 
      this.phaseCode, 
      this.projectType,});

  ProjectStatistical.fromJson(dynamic json) {
    if (json['phaseStatus'] != null) {
      phaseStatus = [];
      json['phaseStatus'].forEach((v) {
        phaseStatus?.add(PhaseStatus.fromJson(v));
      });
    }
    if (json['phaseCode'] != null) {
      phaseCode = [];
      json['phaseCode'].forEach((v) {
        phaseCode?.add(PhaseCode.fromJson(v));
      });
    }
    if (json['projectType'] != null) {
      projectType = [];
      json['projectType'].forEach((v) {
        projectType?.add(ProjectType.fromJson(v));
      });
    }
  }
  List<PhaseStatus>? phaseStatus;
  List<PhaseCode>? phaseCode;
  List<ProjectType>? projectType;
ProjectStatistical copyWith({  List<PhaseStatus>? phaseStatus,
  List<PhaseCode>? phaseCode,
  List<ProjectType>? projectType,
}) => ProjectStatistical(  phaseStatus: phaseStatus ?? this.phaseStatus,
  phaseCode: phaseCode ?? this.phaseCode,
  projectType: projectType ?? this.projectType,
);
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (phaseStatus != null) {
      map['phaseStatus'] = phaseStatus?.map((v) => v.toJson()).toList();
    }
    if (phaseCode != null) {
      map['phaseCode'] = phaseCode?.map((v) => v.toJson()).toList();
    }
    if (projectType != null) {
      map['projectType'] = projectType?.map((v) => v.toJson()).toList();
    }
    return map;
  }

}